home *** CD-ROM | disk | FTP | other *** search
- ; 私製ライブラリ・グラフィック篇
- ; (c) MATSUUCHI Ryosuke in Dec,1992
- ;
- ; gpoint.asm
- ;
- ; 1992. 8. 3(Mon)
- ; 1992.12.28(Sun)
-
-
- public gpoint,_gpoint
- extrn __AddVramBase_edi :near
- extrn __SetVramSeg :near
- extrn __AddVramBase_ebx :near
- extrn __AddVramBase_esi :near
-
- include grplib.inc
-
- assume cs:cseg, ds:dseg
-
-
-
- dseg segment dword 'DATA'
-
- col dd 0
-
- dseg ends
-
-
-
- cseg segment dword 'CODE'
-
- ;---------------------------------------------------------------
- ; _gpoint : 点の色の読み出し
- ; in EAX : x
- ; EBX : y
- ; out EAX : 色
- ;
- ; int gpoint(int x,int y);
- ;---------------------------------------------------------------
-
- align 4
-
-
-
- gpoint proc
- push ebx
- pushfd
- mov eax,[esp+8+4]
- mov ebx,[esp+8+8]
- call _gpoint
- popfd
- pop ebx
- ret
- gpoint endp
-
-
-
- _gpoint proc
- pushad
- push es
- mov ecx,[_nowscrmod]
- cmp ecx,3
- jl #end
- cmp ecx,5
- jge #0
- call gpoint_16
- jmp #end
- #0: cmp ecx,9
- jge #1
- call gpoint_32a
- jmp #end
- #1: cmp ecx,12
- jge #2
- call gpoint_32b
- jmp #end
- #2: cmp ecx,15
- jge #3
- call gpoint_256
- jmp #end
- #3: cmp ecx,19
- jge #end
- call gpoint_32c
- #end: pop es
- popad
- mov eax,[col]
- ret
- _gpoint endp
-
-
-
- pageadr macro
- call __AddVramBase_edi
- endm
-
-
-
- gpoint_16 proc
- ;edi ← アドレス
- mov esi,eax
- and esi,0fff8h
- shr esi,1
- mov edi,ebx
- shl edi,9
- add edi,esi
- pageadr
- ;点の色の読み出し
- call __SetVramSeg
- mov edx,es:[edi] ;edx ← DW データ
- mov ecx,eax ;ecx ← (x % 8) * 4
- and ecx,7
- lea ecx,[ecx*4]
- shr edx,cl ;edx のうち必要なニブルを取り出す
- and edx,0fh
- mov [col],edx
- ret
- gpoint_16 endp
-
-
-
- gpoint_32a proc
- ;edi ← アドレス
- mov edi,ebx
- shl edi,9
- add edi,eax
- add edi,eax
- pageadr
- ;点の色の読み出し
- call __SetVramSeg
- mov dx,es:[edi]
- and edx,7fffh
- mov [col],edx
- ret
- gpoint_32a endp
-
-
-
- gpoint_32b proc
- ;edi ← アドレス
- mov edi,ebx
- shl edi,10
- add edi,eax
- add edi,eax
- pageadr
- ;点の色の読み出し
- call __SetVramSeg
- mov dx,es:[edi]
- and edx,7fffh
- mov [col],edx
- ret
- gpoint_32b endp
-
-
- gpoint_256 proc
- ;★まだ作ってないよん
- ret
- gpoint_256 endp
-
-
- gpoint_32c proc
- ;edi ← アドレス
- mov edi,ebx
- shl edi,10
- add edi,eax
- add edi,eax
- pageadr
- ;点の色の読み出し
- call __SetVramSeg
- mov dx,es:[edi]
- and edx,7fffh
- mov [col],edx
- ret
- gpoint_32c endp
-
-
-
- cseg ends
-
- end
-